﻿using System;

namespace Tequila.Phone.Sharing
{
    /// <summary>
    /// Share service.
    /// </summary>
    public interface IShareService
    {
        /// <summary>
        /// Occurs when the post was successful.
        /// </summary>
        event EventHandler<EventArgs> PostSuccess;

        /// <summary>
        /// Occurs when the post failed.
        /// </summary>
        event EventHandler<ErrorEventArgs> PostError;
        
        /// <summary>
        /// Occurs when login was successful.
        /// </summary>
        event EventHandler<EventArgs> LoginSuccess;

        /// <summary>
        /// Occurs when login failed.
        /// </summary>
        event EventHandler<ErrorEventArgs> LoginError;

        /// <summary>
        /// Occurs when initialization was successful.
        /// </summary>
        event EventHandler<EventArgs> InitSuccess;

        /// <summary>
        /// Occurs when initialization failed.
        /// </summary>
        event EventHandler<ErrorEventArgs> InitError;

        /// <summary>
        /// Occurs when connection was not successful.
        /// </summary>
        event EventHandler<ErrorEventArgs> ConnectionError;

        /// <summary>
        /// Determines whether authentication performed or not.
        /// </summary>
        /// <returns></returns>
        bool IsAuthenticated();

        /// <summary>
        /// When implemented, performs initialization steps.
        /// </summary>
        void Init();

        /// <summary>
        /// When implemented, shares <see cref="Article">article</see>.
        /// </summary>
        /// <param name="article"></param>
        void Post(Article article);

        /// <summary>
        /// When implemented, shares <see cref="GaleryImage">image</see>.
        /// </summary>
        /// <param name="image"></param>
        void PostImage(GaleryImage image);

        /// <summary>
        /// When implemented, returns OAUTH login <see cref="T:System.Uri">uri</see>.
        /// </summary>
        /// <returns>
        /// Type: <see cref="T:System.Uri"/>.
        /// </returns>
        Uri GetOAuthLoginUri();

        /// <summary>
        /// When implemented, returns logout url.
        /// </summary>
        /// <returns>
        /// Type: <see cref="T:System.Uri"/>.
        /// </returns>
        Uri GetLogoutUrl();
        
        /// <summary>
        /// When implemented, processes OAUTH output requested by <see cref="T:System.Uri">uri</see>.
        /// </summary>
        void ProcessOAuthBrowserResult(Uri openedUri);

        /// <summary>
        /// When implemented, creates custom Login uri.
        /// </summary>
        void BuildLoginUri();

        /// <summary>
        /// Gets or sets Current User ID.
        /// </summary>
        long CurrentUserId { get; set; }
    }
}
